//这是文章分类的路由模块
//这是文章分类的

const express = require('express')


const { getArtCates, addArticleCates,updateCateById } = require('../router_handler/artcate')

const router = express.Router()

const artCate_handler = require('../router_handler/artcate')
const {add_cate_schema,delete_cate_schema,get_cate_schema,update_cate_schema}=require('../schema/artcate')

//导入验证数据中间件
const expressJoi = require('@escook/express-joi')

//获取文章分类列表路由
router.get('/cates', artCate_handler.getArtCates)

//新增文章分类路由
router.post('/addcates', expressJoi(add_cate_schema), artCate_handler.addArticleCates)

//删除文章分类路由
router.get('/deletecate/:id',expressJoi(delete_cate_schema) ,artCate_handler.deleteCateById)


// 根据 Id 获取文章分类的路由
router.get('/cates/:id',expressJoi(get_cate_schema),artCate_handler.getArtCateByid)

// 更新文章分类的路由
router.post('/updatecate', expressJoi(update_cate_schema),artCate_handler.updateCateById)


//暴露
module.exports = router
